<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表格查询</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>


<div class="demoTable" style="margin-left: 15px;">
    <form class="layui-form " action="" >
    <div class="layui-form-item">
        <label>公司ID</label>
        <div class="layui-inline">
            <input class="layui-input" name="positionCompanyId" id="positionCompanyId" autocomplete="off">
        </div>


        <label>区域ID</label>
        <div class="layui-inline">
            <input class="layui-input" name="positionAreaId" id="positionAreaId" autocomplete="off">
        </div>


        <label>薪资</label>
        <div class="layui-inline">
            <input class="layui-input" name="positionSalary" id="positionSalary" autocomplete="off">
        </div>
        <label>职位类型ID</label>
        <div class="layui-inline">
            <input class="layui-input" name="positionIndustryId" id="positionIndustryId" autocomplete="off">
        </div>
        <label>职位联系人名字</label>
        <div class="layui-inline">
            <input class="layui-input" name="positionUsername" id="positionUsername" autocomplete="off">
        </div>
        <label>创建时间</label>
        <div class="layui-inline">
            <input class="layui-input" name="poistionCreateTime" id="poistionCreateTime" autocomplete="off">
        </div>
        <label>职位修改时间</label>
        <div class="layui-inline">
            <input class="layui-input" name="poistionUpdateTime" id="poistionUpdateTime" autocomplete="off">
        </div>

        <label>是否删除 0 正常/1删除</label>
        <div class="layui-inline">
            <input class="layui-input" name="poistionIsDelete" id="poistionIsDelete" autocomplete="off">
        </div>

        <label>职位要求</label>
        <div class="layui-inline">
            <input class="layui-input" name="poistionRequirement" id="poistionRequirement" autocomplete="off">
        </div>
        <label>标签集合</label>
        <div class="layui-inline">
            <input class="layui-input" name="poistionLabelIds" id="poistionLabelIds" autocomplete="off">
        </div>

        <label>职位详细地址</label>
        <div class="layui-inline">
            <input class="layui-input" name="positionAddress" id="positionAddress" autocomplete="off">
        </div>
        <label>公司电话</label>
        <div class="layui-inline">
            <input class="layui-input" name="positionPhone" id="positionPhone" autocomplete="off">
        </div>
        <button type="button" class="layui-btn" data-type="reload">
            <i class="layui-icon layui-icon-search">搜索</i>
        </button>
    </div>
    </form>
</div>
<table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/html" id="toolbarDemo">


    <form class="layui-form " action="">
        <div class="layui-form-item" style="margin-left: 15px;">
            <div class="layui-btn-group">
                <#--<button type="button" class="layui-btn" lay-event="add">增加</button>-->
                <button type="button" class="layui-btn" lay-event="edit">编辑</button>
                <button type="button" class="layui-btn" lay-event="show">查看</button>
                <button type="button" class="layui-btn" lay-event="del">删除</button>
            </div>
        </div>

    </form>
</script>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script src="${base}/static/win10/js/StringToDate"></script>

<script>



    layui.use(['table'], function () {
        var table = layui.table;
        table.render({
            skin: 'line' //行边框风格
            , even: true //开启隔行背景
            , elem: '#test'
            , url: base + '/WeChatUser/wechatPosition/admin/findWechatPositionByPage'
            , toolbar: '#toolbarDemo'
            , cols: [[
                {type: 'radio'},
                  {field: 'positionId', title: '职位ID'},
                  {field: 'companyName', title: '公司名字'},
                  {field: 'areaName', title: '所在地址'},
                  {field: 'positionSalary', title: '薪资'},
                  {field: 'jobName', title: '职位名称'},
                  {field: 'positionUsername', title: '职位联系人名字'},
                  {field: 'createTime', title: '创建时间'},
                  {field: 'updateTime', title: '职位修改时间'},
                  // {field: 'poistionIsDelete', title: '是否删除 0 正常/1删除'},
                  {field: 'poistionRequirement', title: '职位要求'},
                  {field: 'poistionLabelIds', title: '标签集合'},
                  // {field: 'positionDescribe', title: '职位描述'},
                  {field: 'positionAddress', title: '职位详细地址'},
                      {field: 'positionPhone', title: '公司电话'}
            ]]
            , page: true
            , id: 'testReload'
        });
        //搜索
        var $ = layui.$, active = {
            reload: function(){
                //执行重载
                table.reload('testReload', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                                    positionCompanyId:$("#positionCompanyId").val(),
                                    positionAreaId:$("#positionAreaId").val(),
                                    positionSalary:$("#positionSalary").val(),
                                    positionIndustryId:$("#positionIndustryId").val(),
                                    positionUsername:$("#positionUsername").val(),
                                    poistionCreateTime:$("#poistionCreateTime").val(),
                                    poistionUpdateTime:$("#poistionUpdateTime").val(),
                                    poistionIsDelete:$("#poistionIsDelete").val(),
                                    poistionRequirement:$("#poistionRequirement").val(),
                                    poistionLabelIds:$("#poistionLabelIds").val(),
                                    positionDescribe:$("#positionDescribe").val(),
                                    positionAddress:$("#positionAddress").val(),
                                    positionPhone:$("#positionPhone").val()
                    }
                }, 'data');
            }
        };
        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });





        //头工具栏事件
        table.on('toolbar(test)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
            var data = checkStatus.data;  //获取选中行数据
            switch (obj.event) {
                case 'add':
                    //请继续补充以下逻辑
                    window.location.href=base+"/WeChatUser/wechatPosition/admin/addWechatPositionHtml"
                    break;
                case 'edit':
                    if (data.length === 0) {
                        layer.alert("请选择一条数据")
                        return;
                    }
                    //请继续补充以下逻辑
                    window.location.href=base+"/WeChatUser/wechatPosition/admin/editWechatPositionHtml?id=" + data[0].positionId
                    break;
                case 'show':
                    if (data.length === 0) {
                        layer.alert("请选择一条数据")
                        return;
                    }
                    //请继续补充以下逻辑
                    window.location.href=base+"/WeChatUser/wechatPosition/admin/showWechatPositionHtml?id=" + data[0].positionId
                    break;
                case 'del':
                    if (data.length === 0) {
                        layer.alert("请选择一条数据")
                        return;
                    }
                    layer.confirm('真的要删除吗?',function(index){
                        $.ajax({
                            type:"POST",
                            url:base+'/WeChatUser/wechatPosition/admin/delWechatPosition',
                            data:{"id":data[0].positionId},
                            success:function(data){
                                if(data.code===200){
                                    layer.msg(data.message)
                                    setTimeout(function () {
                                        window.location.reload();
                                    }, 500)
                                }else{
                                    layer.msg(data.message)
                                }
                            }
                        });
                    });
                    break;
            };
        });
    })
</script>
</body>
</html>